package com.zhi.dao;

import com.zhi.entity.Student;
import com.zhi.entity.Teacher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 教师对象dao层,与数据库交互
 */
public interface TeacherRepository extends JpaRepository<Teacher, String>{


	@Query("SELECT a.id,a.username,a.password,a.userType FROM User a")
	public List<Object[]> getEntityListWithCodeName();
	
	@Query(value = "SELECT t.* FROM Teacher t",
			countQuery ="select count(*) from Teacher",
			nativeQuery = true)
	public Page<Teacher> getEntityListWithCodeName(Pageable pageable);

}
